<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
	<style type="text/css">
		form{
			width: 500px;
			height: 300px;
			border: 1px solid #000;
			margin: 0 auto;
		}
		p{
			text-align: center;
		}
		button{
			margin-left: 240px;
		}
	</style>
</head>
<body>
	<form>
		<p>用户：<input type="text" name="" id="a"></p>
		<p>密码：<input type="text" name="" id="b"></p>
		<button id="c">登陆</button>
	</form>
</body>

<script type="text/javascript">
	var a = document.getElementById('a'); 
	var b = document.getElementById('b'); 
	var c = document.getElementById('c'); 
	var bl = true;
	c.onclick = function () {
		if (a == '' || b == '') {
			c = !bl;
		}else if (a == 'admin' && b == '123456') {
			c = bl;
			
		}
	}

</script>
</html>